import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    username: '张三',
    age: 25,
    email: 'zhangsan@example.com'
  }),
  
  getters: {
    // 获取用户信息
    getUserInfo: (state) => {
      return `${state.username} (${state.age}岁)`
    }
  },
  
  actions: {
    // 更新用户信息
    updateUsername(newName) {
      this.username = newName
    },
    updateAge(newAge) {
      this.age = newAge
    }
  }
}) 